package com.hbnu.entity;

import java.time.LocalDateTime;

import static com.hbnu.tools.FileTool.formatFileSize;
import static com.hbnu.tools.PrintTool.getTime;

public class FileStat {
    private String name;
    private LocalDateTime created_time;
    private long size;
    private String md5;
    private String path;
    //保存打印信息
    private StringBuilder stringBuilder;
    public FileStat(){}

    @Override
    public String toString() {
        if(stringBuilder==null){
            stringBuilder=new StringBuilder();
            stringBuilder.append("文件名: ").append(getName()).append("\n");
            stringBuilder.append("大小: ").append(formatFileSize(getSize())).append("\n");
            stringBuilder.append("md5: ").append(getMd5()).append("\n");
            stringBuilder.append("上传时间: ").append(getTime(getCreated_time()));
        }

        return stringBuilder.toString();
    }



    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public LocalDateTime getCreated_time() {
        return created_time;
    }

    public void setCreated_time(LocalDateTime created_time) {
        this.created_time = created_time;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

}
